<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>内容与查找</title>
	</head>
	<body>
		<div>
			<p>过滤前内容：</p>
		    <textarea id="pre" cols="50" rows="10" wrap="hard"></textarea>
		    <input id="btn" type="button" value="过滤">
		</div>
		<div>
			<p>过滤后内容：</p>
		    <textarea id="res" cols="50" rows="10"></textarea>
		</div>
		<script>
			var btn=document.getElementById('btn');
			btn.onclick=function(){
				var str=document.getElementById('pre').value;
				var reg=/[\u4e00-\u9fa5]|(bad)/gi;
				var newStr=str.replace(reg,'*');
				document.getElementById('res').innerHTML=newStr;
			}
		</script>
	</body>
</html>
